package com.itqf.dao;

import com.itqf.pojo.User;

import java.sql.SQLException;

/**
 * projectName: gpshop
 *
 * @author: 赵伟风
 * time: 2021/7/20 15:18
 * description:
 */
public interface UserDao {

    /**
     * 根据账号查询数据库存在的数量
     * @param uAccount
     * @return
     */
    long queryAccount(String uAccount) throws SQLException;

    /**
     * 插入用户数据到数据库
     * @param user 要插入的数据
     * @return 返回插入影响的行数
     */
    int insertUser(User user) throws SQLException;

    Long queryToken(String token) throws SQLException;

    int updateUser(String token) throws SQLException;

    /**
     * 用户登录查询
     * @param uAccount
     * @param newPassword
     * @return
     */
    User queryUser(String uAccount, String newPassword) throws SQLException;

    /**
     * 根据用户id修改token!
     * @param uid
     * @param token
     */
    void updateTokenById(int uid, String token) throws SQLException;

    User queryUserByToken(String token) throws SQLException;
}
